package com.woniuxy.ticket_cinema.exception;

import com.woniuxy.ticket_cinema.entity.ResponseResult;
import org.springframework.dao.DataAccessException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class CinemaExceptionHandler {

    @ExceptionHandler(CinemaNameExistException.class)
    public ResponseResult<Void> exceptionHandler(){
        return new ResponseResult<>(101,"影院名称重复！");
    }

    @ExceptionHandler(DataAccessException.class)
    public ResponseResult<Void> DataAccessExceptionHandler(){
        return new ResponseResult<>(500,"数据异常！");
    }
}
